package com.huiminpay.merchant.convert;

import com.huiminpay.merchant.dto.MerchantDTO;
import com.huiminpay.merchant.entity.Merchant;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @Author: yz
 * @Date: 2024/7/19 14:49
 */
// mapstruct 对象转换: 按约定 实现对象之间的自动转换
@Mapper //mapper映射
public interface MerchantConvert {

    // 获取当前类的字节码 ,根据字节码获取代理对象
    MerchantConvert INSTANCE = Mappers.getMapper(MerchantConvert.class);

    //entity 转DTO
    MerchantDTO entity2DTO(Merchant merchant);

    //DTO 转entity
    Merchant DTO2Entity(MerchantDTO merchantDTO);

    List<MerchantDTO> entityList2DTOList(List<Merchant> merchantList);

    List<Merchant> DTOList2EntityList(List<MerchantDTO> merchantDTOList);

}